Repository navigation
providers: sqlate/postgres/pgtest, the one scratch-database helper - #25
Merged
Merged
Conversation
- workflows: jdx/mise-action v5.2.7 -> v5.2.9 (ci.yml; release.yml does not use it) - compose/postgres/Dockerfile: postgres 18.6-alpine -> 18.7-alpine - docs/quick-start.md: the quoted Dockerfile follows its FROM line Both are bug and security fixes with nothing to adapt. Pin bumps are not recorded in the changelog, matching past upgrades. The integration tier passes against 18.7 on the existing development volume.
pgtest folds go-messaging's pgtest and blobfs's internal dbtest into one public package of the postgres module: Create makes <prefix>_test_<hex> on the server whose admin DSN the named variable holds (failing the test when it is unset), Migrated applies migrate sets under the PostgreSQL dialect, and Database.Session wraps the pool under postgres.Dialect. At cleanup the pool closes and the database drops WITH (FORCE), retrying while the server reports a closing session; a timed-out CREATE is dropped IF EXISTS on its own context. The database name is quoted with pgx.Identifier, so it reaches the server exactly as the returned DSN spells it, and failure messages name the database rather than the DSN, which carries the password. The live proof holds a second pool's session open across the drop and checks from the admin connection that the database is gone.
- [v0.8.0] - 2026-11-17 heads the pgtest Added entries; [Unreleased] is empty above it, and the compare links gain v0.8.0's (postgres/v0.7.0...postgres/v0.8.0) with [Unreleased] from postgres/v0.8.0. - No Requires line: the sqlate requirement is unchanged from v0.7.0.
…s.md, as STANDARDS.md requires of a documented change
… sleeps only between drop attempts; its live test fails rather than panics without a held session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
v1.ai.processing · task 8/11 · providers
Summary
sqlate/postgres/pgtest (new) one throwaway database per test
├ go-messaging/postgres onto pgtest; its own pgtest removed (Breaking)
└ blobfs/postgres onto pgtest; dbtest keeps only blobfs's helpers
docproc
├ go.work base · storage · postgres
├ storage/ (new module) dispatch.Content over go-storage
├ postgres/ (new module) dispatch.Index over sqlate on pgx
└ compose: PostgreSQL 18.7 :5436 · SeaweedFS 4.54 :8334
mise run integration → integration:postgres + integration:storage
Core changes
type Database struct { Pool *sql.DB; DSN string }
func Create(t testing.TB, env, prefix string) *Database
func Migrated(t testing.TB, env, prefix string, sets ...migrate.Set) *Database
func (d *Database) Session() *sqlate.DB
why: round 2 — the third copy would have been docproc's; all users move first
key ab/ab12… (stable; slashes on every platform); no sweeper
why: rounds 1–2 — FileContent's layout; the host's lifecycle rule sweeps
claim/renew/flush/record/release: conditional on the token, database clock
entry and log items as jsonb with dispatch.Version; Append buffers Flush items
Wait: LISTEN docproc_index on one held conn (Close), NOTIFY from
Release/Record/Drop, a timer at a dead claimant's lease expiry
why: rounds 1–2 — Wait on LISTEN since pgx is already in the graph
oldest first, never a live claim; age runs from the entry's first claim
why: round 1 Q8 — Index has no listing, so the host can't sweep with Drop
Evidence
mise run check (sqlate, go-messaging, blobfs, docproc) ✓ all exit 0, lint 0 issues, sqlint ok
docproc mise run integration ✓ postgres 28 tests (dispatchtest Index
suite whole, Wait ×6, Retention ×3),
storage 9 (Content suite on s3/SeaweedFS)
docproc mise run test:integration ✓ tools tier over this checkout's builds,
then integration (slice 14)
sqlate mise run db:up && mise run integration && mise run db:down
✓ pgtest drop with a session open
go-messaging mise run integration ✓ postgres, nats, natstest
blobfs mise run acceptance ✓ postgres tier through pgtest
mise run currency (all four) ✓ only docproc's three recorded holds
spec review ✓ behaviors 1–15, no gaps
Decided without you
decision (age from first claim; neither Record nor a takeover refreshes it). The
slice 14 implementer caught it; fixed in 20f09b5 and the tests pin it.
NewMemoryIndex do, rather than a Config struct (standards-reviewer raised it).
sqlate.DB doesn't expose its pool. Index.Close releases the lazy LISTEN conn.
currency; CI's integration job has its own paths filter and workflow_dispatch.
fails, checked by mutation); a listener-restart test no longer passes on the
dying backend; version refusal and UTC TestMain tightened; sqlate's pgtest
documented in README and docs/, a pool leak fixed.
Merge danger
one-way door: the tags sqlate postgres/v0.8.0, go-messaging postgres/v0.4.0,
docproc storage/v0.1.0 and postgres/v0.1.0, and go-messaging's pgtest removal
once released
SHIP order: sqlate merges and tags postgres/v0.8.0 first; then docproc,
go-messaging, and blobfs each swap the temporary replace for v0.8.0 (blobfs
bumps its require from v0.7.0), pass CI, and merge; then tag storage/v0.1.0,
postgres/v0.1.0, and go-messaging's postgres/v0.4.0
blast radius: go-web-service will see go-messaging/postgres v0.4.0 trailing
(no pgtest use, nothing to adapt); a plan-v1.ai.processing PR then drops
sqlate, go-messaging, and blobfs from the goal's repos
Needs you
(none)